Sequence Diagram for the Amazon Online Shopping System
Create a sequence diagram for checkout and payment of an order, and solve a challenge.
We'll cover the following
Sequence diagrams are a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for the Amazon online shopping system. For this lesson, we’ll create sequence diagrams for the following two interactions:
Checkout and payment: The user checks out and pays for their order using a credit card.
Sequence challenge: The user searches and adds an item to the shopping cart.
Checkout and payment#
The sequence diagram for order checkout and payment should have the following actors and objects that will interact with each other:
Actor:
Customer
Objects:
ShoppingCart
,Order
,Item
, andPayment
Here’re the steps in the order checkout and payment interaction:
The customer requests the shopping cart items and amount.
The customer then places the order for the requested items.
The items are verified for availability.
If the item quantity is less than the available count:
The order status is updated.
The customer is informed that the order is ready for payment.
The customer initiates a payment against the order amount using their card.
The payment is processed.
The customer is informed of the updated payment status.
Else if the item quantity is greater than the available count:
The item in the order is unavailable.
The customer receives an error for the unavailable item.
Based on the order above, the sequence diagram below represents the order checkout and payment process in an online shopping system.
Sequence challenge: Search and add items to the cart#
You will help us complete a sequence diagram for searching and adding items to the cart. A skeleton of the search and add item sequence diagram is given below:
Notice that the arrows in the diagram above are numbered from 1 to 8. The message boxes shown below are the messages to be exchanged between the actor(s) and object(s). Can you rearrange the messages below in the correct sequence of order they should appear in the skeleton of the sequence diagram provided above?
Note: If you get stuck, just click the “Show Solution” button to check the correct answer.
Alternatively, you can also click the "Show complete diagram" button below to view the complete sequence diagram for the search and add items to the cart interaction.
Next, let’s look at the activity diagrams for the online shopping system to understand the control flow of the system.
Class Diagram for the Amazon Online Shopping System
Activity Diagram for the Amazon Online Shopping System